<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>FLbutBank</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="FLbox.html" title="FLbox" />
    <link rel="next" href="FLbutton.html" title="FLbutton" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLbutBank</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLbox.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="FLbutton.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="FLbutBank"></a>
      <div class="titlepage"></div>
      <a id="IndexFLbutBank" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLbutBank</span>
        </h2>
        <p>FLbutBank — 
      A FLTK widget opcode that creates a bank of buttons.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp103720864"></a>
        <h2>Description</h2>
        <p>
      A FLTK widget opcode that creates a bank of buttons.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp103722016"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kout, ihandle <span class="command"><strong>FLbutBank</strong></span> itype, inumx, inumy, iwidth, iheight, ix, iy, \
      iopcode [, kp1] [, kp2] [, kp3] [, kp4] [, kp5] [....] [, kpN]</pre>
      </div>
      <div class="refsect1">
        <a id="idp103724320"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ihandle</em></span> -- a handle value (an integer number) that unequivocally references a corresponding widget. This is used by other opcodes that modify a widget's properties (see <a class="link" href="ControlFltkAppearance.html" title="Modifying FLTK Widget Appearance"><em class="citetitle">Modifying FLTK Widget Appearance</em></a>). It is automatically output by <span class="emphasis"><em>FLbutBank</em></span> and must not be set by the user label. (The user label is a double-quoted string containing some user-provided text placed near the widget.)
    </p>
        <p>
      <span class="emphasis"><em>itype</em></span> -- an integer number denoting the appearance of the widget. The valid numbers are:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>1 - normal button</p>
            </li>
            <li class="listitem">
              <p>2 - light button</p>
            </li>
            <li class="listitem">
              <p>3 - check button</p>
            </li>
            <li class="listitem">
              <p>4 - round button</p>
            </li>
          </ul>
        </div>
        <p>
      You can add 20 to the value to create a "plastic" type button. (Note that there is no Platic Round button. i.e. if you set type to 24 it will look exactly like type 23).
    </p>
        <p>
      <span class="emphasis"><em>inumx</em></span> -- number of buttons in each row of the bank.
    </p>
        <p>
      <span class="emphasis"><em>inumy</em></span> -- number of buttons in each column of the bank
    </p>
        <p>
      <span class="emphasis"><em>ix</em></span> -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window, expressed in pixels
    </p>
        <p>
      <span class="emphasis"><em>iy</em></span> -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window, expressed in pixels
    </p>
        <p>
      <span class="emphasis"><em>iopcode</em></span> -- score opcode type. You have to provide the ascii code of the letter corresponding to the score opcode. At present time only <span class="quote">“<span class="quote">i</span>”</span> (ascii code 105) score statements are supported. A zero value refers to a default value of <span class="quote">“<span class="quote">i</span>”</span>. So both 0 and 105 activates the <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i</em></a> opcode. A value of -1 disables this opcode feature.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp103737760"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kout</em></span> -- output value
    </p>
        <p>
      <span class="emphasis"><em>kp1</em></span>, <span class="emphasis"><em>kp2</em></span>, ..., <span class="emphasis"><em>kpN</em></span> -- arguments of the activated instruments.
    </p>
        <p>
      The <span class="emphasis"><em>FLbutBank</em></span> opcode creates a bank of buttons. For example, the following line:
      </p>
        <div class="informalexample">
          <pre class="programlisting">
gkButton,ihb1  FLbutBank  22, 8, 8, 380, 180, 50, 350, 0, 7, 0, 0, 5000, 6000
        </pre>
        </div>
        <p>

      will create the this bank:

      </p>
        <div class="mediaobject">
          <img src="images/flbutbank.png" alt="FLbutBank." />
          <div class="caption">
            <p>FLbutBank.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      A click to a button checks that button. It may also uncheck a previous checked button belonging to the same bank. So the behaviour is always that of radio-buttons. Notice that each button is labeled with a progressive number. The <span class="emphasis"><em>kout</em></span> argument is filled with that number when corresponding button is checked.
    </p>
        <p>
      <span class="emphasis"><em>FLbutBank</em></span> not only outputs a value but can also activate (or schedule) an instrument provided by the user each time a button is pressed. If the <span class="emphasis"><em>iopcode</em></span> argument is set to a negative number, no instrument is activated so this feature is optional. In order to activate an instrument, <span class="emphasis"><em>iopcode</em></span> must be set to 0 or to 105 (the ascii code of character <span class="quote">“<span class="quote">i</span>”</span>, referring to the <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i</em></a> score opcode). P-fields of the activated instrument are <span class="emphasis"><em>kp1</em></span> (instrument number), <span class="emphasis"><em>kp2</em></span> (action time), <span class="emphasis"><em>kp3</em></span> (duration) and so on with user p-fields.
    </p>
        <p>
      The <span class="emphasis"><em>itype</em></span> argument sets the type of buttons identically to the <a class="link" href="FLbutton.html" title="FLbutton"><em class="citetitle">FLbutton</em></a> opcode. By adding 10 to the <span class="emphasis"><em>itype</em></span> argument (i.e. by setting 11 for type 1, 12 for type 2, 13 for type 3 and 14 for type 4), it is possible to skip the current <span class="emphasis"><em>FLbutBank</em></span> value when getting/setting snapshots (see <a class="link" href="ControlFltkGeneral.html" title="General FLTK Widget-related Opcodes"><em class="citetitle">General FLTK Widget-related Opcodes</em></a>). You can also add 10 to "plastic" button types (31 for type 1, 32 for type 2, etc.)
    </p>
        <p>
      FLbutBank is very useful to retrieve snapshots.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp103756704"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLbutBank opcode. It uses the file <a class="ulink" href="examples/FLbutBank.csd" target="_top"><em class="citetitle">FLbutBank.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp103758528"></a>
          <p class="title">
            <strong>Example 263. Example of the FLbutBank opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o FLbutton.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="opc">FLpanel</span> "Button Bank", 520, 140, 100, 100
    <span class="comment">;itype = 2    ;Light Buttons</span>
    itype <span class="op">=</span> 22    <span class="comment">;Plastic Light Buttons</span>
    inumx <span class="op">=</span> 10
    inumy <span class="op">=</span> 4
    iwidth <span class="op">=</span> 500
    iheight <span class="op">=</span> 120
    ix <span class="op">=</span> 10
    iy <span class="op">=</span> 10
    iopcode <span class="op">=</span> 0
    istarttim <span class="op">=</span> 0
    idur <span class="op">=</span> 1

    gkbutton, ihbb <span class="opc">FLbutBank</span> itype, inumx, inumy, iwidth, iheight, ix, iy, iopcode, 1, istarttim, idur

<span class="opc">FLpanelEnd</span>
<span class="opc">FLrun</span>

<span class="oblock">instr</span> 1
  ibutton <span class="op">=</span> <span class="opc">i</span>(gkbutton)
  <span class="opc">prints</span> "Button <span class="op">%</span><span class="opc">i</span> pushed!\\n", ibutton  
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Real-time performance for 1 hour.</span>
<span class="stamnt">f</span> 0 3600
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp103762816"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLbox.html" title="FLbox"><em class="citetitle">FLbox</em></a>,
      <a class="link" href="FLbutton.html" title="FLbutton"><em class="citetitle">FLbutton</em></a>,
      <a class="link" href="FLprintk.html" title="FLprintk"><em class="citetitle">FLprintk</em></a>,
      <a class="link" href="FLprintk2.html" title="FLprintk2"><em class="citetitle">FLprintk2</em></a>,
      <a class="link" href="FLvalue.html" title="FLvalue"><em class="citetitle">FLvalue</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp103768704"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 4.22</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLbox.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="FLbutton.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLbox </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> FLbutton</td>
        </tr>
      </table>
    </div>
  </body>
</html>
